<template>
  <div>
    <a-input  style="width: 40%;margin-right: 5px;" @change="onChange"  v-model="args.name" :placeholder="i18n('form.param','参数')"></a-input>
    <a-input style="width: 40%" v-model="args.regular" :placeholder="i18n('predicate.regex','正则表达式')"></a-input>
  </div>
</template>

<script>
  export default {
    name: "QueryEdit",
    props: ["value"],
    data() {
      return {
        args:{
          name:"",
          regular:""
        }
      }
    },
    created() {
      this.init();
    },
    methods: {
      i18n(name,text,key){
        return this.$ti18(name,text,"SysRouting",key);
      },
      init() {
        if (this.value.predicateArgs == "") {
          this.args = {
            name:"",
            regular:""
          };
        } else {
          this.args.name = (JSON.parse(this.value.predicateArgs))._genkey_0;
          this.args.regular = (JSON.parse(this.value.predicateArgs))._genkey_1;
        }
      },
      onChange(){
        var obj={
          _genkey_0:this.args.name,
          _genkey_1:this.args.regular
        };
        this.value.predicateArgs=JSON.stringify(obj);
      }
    },
  }
</script>

<style scoped>

</style>